﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using JTicket.BLL;

namespace JTicket.UI
{
    public partial class JT_CardAdd : RoleBase
    {
        private readonly BLL.D_OperInfo bllOper = new BLL.D_OperInfo();
        protected void Page_Load(object sender, EventArgs e)
        {
            this.Button2.Attributes.Add("onclick", ClientScript.GetPostBackEventReference(Button2, "Click") + ";this.disabled=true; this.value='读取中...';");
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            string OperCode = bllOper.Oper().OperCode;

            string result = DAL.D_KaInfo.KaOperate(this.t1.Text, this.t2.Text, this.t3.Text, this.t4.Text, this.t6.Text, Common.DESEncrypt.Encrypt("888888"), OperCode, this.t5.Text, "", "卡登记");
            this.t1.Text = "";
            this.t2.Text = "";
            this.t3.Text = "";
            this.t4.Text = "";
            this.t5.Text = "0";
            this.t6.Text = "0";
            Common.JsMsg.Alert(result);
            this.Label1.Text = "找零：" + Convert.ToString(Convert.ToInt32(this.t5.Text) - Convert.ToInt32(this.t6.Text));
           
        }

        protected void Button2_Click(object sender, EventArgs e)
        {
            string str = Printer.CardBusiness.GetCadID();
            if (str != "系统未连接读卡器")
            {
                this.t1.Text = str;
            }
            else
            {
                Common.JsMsg.Alert("系统未连接读卡器");
                this.Button1.Enabled = false;
            }

        }
    }
}